package com.example.basic.utils; /**
 * @Author： Be.insighted
 * Description：
 * @date Create on 2020/7/14 16:35
 **/

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class TimeUtils {
    /**
     * 把时间戳转换为：时分秒
     *
     * @param millisecond ：毫秒，传入单位为毫秒
     */
    public static String getTimeString(final long millisecond) {
        //转化为秒
        long second = millisecond / 1000;
        //剩余秒数
        long seconds = second % 60;
        //转化为分钟
        long minutes = second / 60;
        //剩余分钟
        long minute = minutes % 60;
        //剩余小时数
        long hours = minutes / 60;

        String timeString = hours + ":" + minute + ":" + seconds;

        return timeString;
    }


}